﻿//Class and project am object
// classe e  um  projeto de um Objeto
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;




namespace GamePlay
{
    public class builder : Game
    {
        //variable
        //GraphicsDeviceManager graphics;
        public Texture2D texture;
        public Vector2 Position;



        //private Rectangle RectH;
        //private Rectangle RectG;
        //RandomObject ro;
        
        //KeyboardState keyboard_1;

        
        
        //public float speed = 8f;
        //construction
        
            public builder()
            {

            
                Position = new Vector2(400,620);
            
            


            }
             public builder(Texture2D texture, Vector2 position)
            {
                //Texture = texture;
                Position = position;

            
            
            
             }
        

             public void Update()
             {
                 

                     if (Keyboard.GetState().IsKeyDown(Keys.Left))
                     //if (keyboard_1.IsKeyDown(Keys.Left))
                
                     {
                         //Position.X = Texture.Width;
                         //Position.X -=  10;
                         this.Position.X -= 10;
                         //Console.WriteLine(" Hello Heingt");
                 
                 
                     }
                     if (Keyboard.GetState().IsKeyDown(Keys.Right))
                     //if (keyboard_1.IsKeyDown(Keys.Right))
                     {
                         Position.X += 10;
                        //Console.WriteLine(" Hello Right ");
                         //Console.WriteLine(Position);
                     }



                     if (Keyboard.GetState().IsKeyDown(Keys.Up))
             
                     {
                         Position.Y -= 10;
                         //Console.WriteLine(Position);



                     }

                     #region (System Colision Window aplication)  As 3  "ctrl  + C   end ctrl  + V"
                     //Colision Exo X
                     if (Position.X < Window.ClientBounds.Width - Window.ClientBounds.Width)
                     {
                         Position.X = Window.ClientBounds.Width - Window.ClientBounds.Width;
                     }
                     if (Position.X > Window.ClientBounds.Width)
                     {
                         //Position.X = 400;

                         Position.X = Window.ClientBounds.Width;
                         //this.Position.X += 10;
                         //Console.WriteLine(Position);
                     }
                     //  Colision Exo Y
                     if (Position.Y < Window.ClientBounds.Height - Window.ClientBounds.Height)
                     {
                         //Retorna abaixo
                         Position.Y = Window.ClientBounds.Height ;

                         //Toca o som Quando Collide com atura da janela

                         //SoundManager.PlaySoundEffect("Pam-Pan");
                 
                         //Retorna a possição  central
                         Position.X = 400;

                     }
                     #endregion  End

                 

                 
                        

            
            

                 }

            
             
            public void Draw(SpriteBatch spriteBatch)
            {

                spriteBatch.Draw(texture, Position, Color.White);
          

                }


        
        }


        }

